<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js中的数组</title>
</head>
<body>
    <script type="text/javascript">
        var v1=["刘朝朋","鲁亚飞","朱振凯","范凯","陈宏伟"]
        v1[1]="史璐可" //将数组下标为1的数据更改为"史璐可"
        console.log(v1)
        v1.push("张三丰") //在数组的最后增加一个字符串"张三丰"
        console.log(v1)
        v1.unshift("周芷若")// 在数组的最前面增加字符串"周芷若"
        console.log(v1)
        v1.splice(3,0, "令狐冲") //在数组的指定下标位置增加字符串"令狐冲",3是下标位置，0代表增加
        console.log(v1)
        v1.splice(5,1)  //将数组的指定下标位置删除字符串,5是下标,1代表删除
        console.log(v1)
        v1.pop()//从尾部删除
        console.log(v1)
        v1.shift()//从开头删除
        console.log(v1)

        var v2=["降龙十八掌","九阴真经","乾坤大挪移","太极拳","六脉神剑","凌波微步","黯然销魂掌"]
        for(var idx in v2){      //idx 是索引
            console.log(v2[idx])
        }

        var v3=["西游记","红楼梦","三国演义","水浒传","封神榜"]

        for(var i=0;i<v3.length;i++){
            console.log(v3[i])
        }


    </script>
</body>
</html>